A little earlier, I commented that I was annoyed that I couldn't just "Run Command" a firefox window. After poking around a little bit, I realized that it was because the of the way mozilla-launcher handles URL parameters. For anyone that's interested, all you have to do is change the try_running function in the mozilla-launcher bash script. My ugly hack for fixing it is below. I've testing it approximately not at all (aside from the fact that it seems to do what I want it to do), so YMMV.
try_running() {
declare s retval=2 # default == can't find an instance
# Try mozilla-xremote-client on each candidate screen.
for s in "${candidates[@]}"; do
DISPLAY=$s $remote -a ${progname} "$@"
retval=$?
if [[ $retval -eq 0 ]]; then
candidates=("$s") # for future calls
return 0
fi
done
# OK, now try again and see if we should prepend http://
if [[ $retval -eq 3 ]]; then
for s in "${candidates[@]}"; do
loc=$(expr index "$@" "\(")
words=$@
DISPLAY=$s $remote -a ${progname} "openURL(http://${words:$loc}"
retval2=$?
if [[ $retval2 -eq 0 ]]; then
candidates=("$s") # for future calls
return 0
fi
done
fi
# Might as well do this error interpretation here
case $retval in
1) echo "Unable to connect to X server" >&2 ;;
2) echo "No running windows found" >&2 ;;
3) echo "Browser doesn't understand command" >&2 ;;
*) echo "Unknown error $retval from mozilla-xremote-client" >& ;;
esac
return $retval
}
Published by
XPost